function modifyAccount()
{
    var money = $("#modifyAccountMoney").val();
    var name = $("#modifyAccountName").val();
    var id = $("#AccountDetailid").attr("data-id");
    var account = new Account(id,name,money);
    $("#accountdetailname").html(name);
    $("#accountdetailmoney").html(money);
    account.Update();
    
    $('#editAccountContent').slideToggle('normal');
}

function InitAccountDetail(accountid)
{
    datamodel.init();
    $('#accountDetailList').html("");
    var account = datamodel.getAccount(accountid);            
    $("#accountdetailname").html(account.name);
     $("#accountdetailmoney").html(account.money);
     $("#AccountDetailid").attr("data-id",accountid);
     
     $("#modifyAccountName").val(account.name);
     $("#modifyAccountMoney").val(account.money);
     
     var dates = new Array();
     for(var key in datamodel.turnovers)
     {
        var itemData = datamodel.turnovers[key];
        //当前流水不是转账,并且from和to中有一者是当前账户
        if(itemData.type != 2 && (itemData.from == accountid || itemData.to == accountid))
        {
            var currDate = StrToDate(datamodel.turnovers[key].time);
            var timeStr = currDate.format("yyyy-MM-dd");
            var listid = timeStr + "list";
            if(!arrayexist(dates,timeStr))
            {
                dates.push(timeStr);

                 var dateHTML = 
                        "<h3>{0}</h3><div class=\"category\"><ul id=\"{1}\"></ul></div>"
                
                  dateHTML = 
                  dateHTML.format(timeStr,listid);
                  $('#accountDetailList').append(dateHTML);
            }
            
            
            var detailHTML = "<li class=\"{0} li\"><a><i class=\"{0}-icon\"></i><div class=\"left\">"
                            + "<span class=\"accoutname\">{3}</span><br /> <span class=\"date\">{4}</span>"
                            + "<span class=\"remark\">{2}</span></div><div class=\"right\"><span class=\"money\">￥{1}</span>"
                            + "</div></a></li>";
                            
            var catClassName = catidToClassStr(itemData.catid); 
            var cat = datamodel.getCategory(itemData.catid);
              var leftMainStr = ""
              if(cat)
              {
                 leftMainStr = cat.name;
              } 
            detailHTML = detailHTML.format(catClassName,itemData.money,itemData.remark,leftMainStr,timeStr);
            
            $('#' + listid).append(detailHTML);
            
        }
     }
     
   // $("[data-page=accountdetail]").append(accounttitle);
                        
                            
                            
                        
                        
                        
                            
                            
                       
                  

            
}